package com.littleken.listener;

import com.littleken.utils.SqlSessionFactoryUtils;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class initSqlSessionListener implements ServletContextListener {
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("容器初始化");
        SqlSessionFactoryUtils.initSqlSessionFactory();
    }

    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("容器销毁");
        SqlSessionFactoryUtils.cloes();
    }
}
